package com.mia.props.common.entities;

import com.mia.props.common.TileProps;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayer.EnumStatus;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.World;

public class TileBed extends TileProps {
   public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float var7, float var8, float var9) {
      if (this.isBed() && !world.isRemote) {
         EnumStatus enumstatus = player.sleepInBedAt(x, y, z);
         if (enumstatus == EnumStatus.OK) {
            return true;
         } else {
            if (enumstatus == EnumStatus.NOT_POSSIBLE_NOW) {
               player.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
            } else if (enumstatus == EnumStatus.NOT_SAFE) {
               player.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
            }

            return true;
         }
      } else {
         return false;
      }
   }

   public boolean isBed() {
      return true;
   }
}
